-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Dependency Scanning] Bridge Clang dependency scanner results on-demand #83600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@swift-ci smoke test |
f345188
to
4876b2f
Compare
@swift-ci smoke test |
4876b2f
to
8cf2714
Compare
@swift-ci smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function wise it is all good. Just some comments about the APIs.
clang::tooling::dependencies::ModuleOutputKind)>; | ||
|
||
ModuleDependencyInfo | ||
bridgeClangModuleDependency( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be a static method as implementation details.
Or maybe it can be a private method in DependencyScanner? The callbacks all have a capture of the scanner reference, which is probably fine since scanner should outlive everything but if the bridging callbacks are part of the scanner, then there is no need for callback or worry about lifetimes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This required a bigger refactor than it originally seemed, but I moved the bridging code into a private scanner utility.
@swift-ci smoke test |
1 similar comment
@swift-ci smoke test |
@swift-ci smoke test Linux platform |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly better. Still some comments about how functions are layered.
@@ -163,6 +164,12 @@ using ModuleDependencyIDSetVector = | |||
llvm::SetVector<ModuleDependencyID, std::vector<ModuleDependencyID>, | |||
std::set<ModuleDependencyID>>; | |||
|
|||
/// A callback to lookup module outputs for "-fmodule-file=", "-o" etc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are left over from previous change? Those are not used in this header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to ModuleDependencyScanner.h
where the uses are.
/// \returns \c true if an error occurred, \c false otherwise | ||
bool scanHeaderDependenciesOfSwiftModule( | ||
const ASTContext &ctx, | ||
/// of a Swift module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the Doxygen comments are removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Instead of always bridging all of the discovered modules of all of the queries, only do so for modules which are not already cached
36ea30d
to
d228d30
Compare
@swift-ci smoke test |
…leDependencyScanner' utility This moves the functionality of 'bridgeClangModuleDependency' into a utility in the main scanner class because it relies on various objects whose lifetime is already tied to the scanner itself.
d228d30
to
9f0083c
Compare
@swift-ci smoke test |
#83050 changed the behavior to query every Clang module identifier imported from Swift, even for modules which may have previously been discovered as transitive dependencies of another query. This means we now have a lot of results coming in from Clang scanner queries which are redundant, and we bridge them all, all of the time, which adds up to a substantial amount of time.
Instead of always bridging all of the discovered modules of all of the queries, only do so for modules which have not already been cached at the time we record query results.